<%@ page import="cn.myschool.entity.Subject" %>
<%@ page import="cn.myschool.severs.SubjectServer" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<%
    String ip=request.getRemoteHost();
    request.setCharacterEncoding("utf-8");
    String id=request.getParameter("id");
    String subjectname=request.getParameter("subjectname");
    String classhour=request.getParameter("classhour");
    String gradeid=request.getParameter("gradeid");
    if (classhour.equals("")||gradeid.equals("")){
        response.sendRedirect("welcome.jsp");
    }
    Subject subject = new Subject(subjectname, Integer.parseInt(classhour), Integer.parseInt(gradeid));
    subject.setId(Integer.parseInt(id));
    int add = SubjectServer.ME.update(subject);
    if(add>0){
        session.setAttribute("msg","修改成功");
        response.sendRedirect("subject.jsp");
    }else {
        session.setAttribute("msg","修改失败");
        response.sendRedirect("welcome.jsp");
    }

%>
</body>
</html>